/*
 * @Description: 我的页面ui
 * @Author: iamsmiling
 * @Date: 2021-05-25 08:50:23
 * @LastEditTime: 2021-06-13 18:17:29
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/components/image/chimera_image.dart';
import 'package:credit_business_circle/domain/local/king_kong_entity.dart';
import 'package:credit_business_circle/domain/local/list_tile_entity.dart';
import 'package:credit_business_circle/pages/mine/mine_controller.dart';
import 'package:credit_business_circle/routes/app_routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MinePage extends GetView<MineController> {
  const MinePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: R.color.ffffffff,
      appBar: AppBar(
        backgroundColor: R.color.ff2eab86,
        title: Text(
          "我的",
          style: TextStyle(
              color: R.color.ffffffff,
              fontSize: R.dimen.sp18,
              fontWeight: FontWeight.w500),
        ),
        centerTitle: false,
        elevation: .5,
        actions: [
          TextButton.icon(
              onPressed: () => Get.toNamed(AppRoutes.mine + AppRoutes.profile),
              icon: Image.asset(
                R.image.edit,
                color: R.color.ffffffff,
              ),
              label: Text(
                "编辑资料",
                style:
                    TextStyle(fontSize: R.dimen.sp13, color: R.color.ffffffff),
              ))
        ],
      ),
      body: SingleChildScrollView(
        child: Container(
          margin: EdgeInsets.only(
            top: R.dimen.dp34,
            left: R.dimen.dp15,
            right: R.dimen.dp15,
          ),
          child: Column(
            children: [
              Row(
                children: [
                  Container(
                    margin: EdgeInsets.only(right: R.dimen.dp16),
                    child: ChimeraImage(
                      src:
                          "https://pic1.zhimg.com/v2-85a2606061bb0da785f44fbdd236d2c8_r.jpg",
                      width: R.dimen.dp68,
                      height: R.dimen.dp68,
                      fit: BoxFit.fill,
                      borderRadius: BorderRadius.circular(R.dimen.dp68 / 2),
                    ),
                  ),
                  Expanded(
                      child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        "麻花腾",
                        style: TextStyle(
                          color: R.color.ff111111,
                          fontSize: R.dimen.sp16,
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.symmetric(vertical: R.dimen.dp8),
                        child: Row(
                          children: [
                            Text(
                              "Jony马",
                              style: TextStyle(
                                color: R.color.ff111111,
                                fontSize: R.dimen.sp16,
                              ),
                            ),
                            Container(
                                margin: EdgeInsets.only(left: R.dimen.dp13),
                                child: Text(
                                  "总经理",
                                  style: TextStyle(
                                    fontSize: R.dimen.sp14,
                                    color: R.color.ff555555,
                                  ),
                                )),
                            Container(
                              margin: EdgeInsets.only(left: R.dimen.dp16),
                              padding: EdgeInsets.symmetric(
                                  horizontal: R.dimen.dp10,
                                  vertical: R.dimen.dp2),
                              decoration: BoxDecoration(
                                  gradient: LinearGradient(colors: [
                                    R.color.ff0fbde8,
                                    R.color.ff39cded
                                  ]),
                                  borderRadius:
                                      BorderRadius.circular(R.dimen.sp9)),
                              child: Row(
                                children: [
                                  Image.asset(R.image.person),
                                  Container(
                                    margin: EdgeInsets.only(left: R.dimen.dp4),
                                    child: Text(
                                      "已实名",
                                      style: TextStyle(
                                          fontSize: R.dimen.sp11,
                                          color: R.color.ffffffff),
                                    ),
                                  )
                                ],
                              ),
                            )
                          ],
                        ),
                      ),
                      Text(
                        "温州游模网络科技有限公司",
                        style: TextStyle(
                            fontSize: R.dimen.sp14,
                            color: R.color.ff555555,
                            fontWeight: FontWeight.w500),
                      )
                    ],
                  ))
                ],
              ),
              Container(
                margin:
                    EdgeInsets.only(top: R.dimen.dp36, bottom: R.dimen.dp20),
                child: Stack(
                  alignment: AlignmentDirectional.center,
                  children: [
                    Image.asset(
                      R.image.mineVipBg,
                      width: R.dimen.width,
                      fit: BoxFit.fitWidth,
                    ),
                    Container(
                      padding: EdgeInsets.symmetric(horizontal: R.dimen.dp13),
                      child: Row(
                        children: [
                          Image.asset(R.image.crown),
                          Container(
                            margin: EdgeInsets.only(left: R.dimen.dp9),
                            child: Text(
                              "开通VIP会员立享超值特权",
                              style: TextStyle(
                                  color: R.color.fffef1cf,
                                  fontSize: R.dimen.sp13),
                            ),
                          ),
                          Spacer(),
                          Container(
                            padding: EdgeInsets.symmetric(
                                horizontal: R.dimen.dp8,
                                vertical: R.dimen.dp6 / 2),
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.circular(R.dimen.sp11),
                                gradient: LinearGradient(colors: [
                                  R.color.fffbefd0,
                                  R.color.fffae2a0
                                ])),
                            child: GestureDetector(
                              onTap: () =>
                                  Get.toNamed(AppRoutes.mine + AppRoutes.vip),
                              child: Row(
                                children: [
                                  Container(
                                    margin: EdgeInsets.only(right: R.dimen.dp2),
                                    child: Text(
                                      "立即开通",
                                      style: TextStyle(
                                          color: R.color.ff56360e,
                                          fontSize: R.dimen.sp11),
                                    ),
                                  ),
                                  Image.asset(R.image.rightArrow)
                                ],
                              ),
                            ),
                          )
                        ],
                      ),
                    )
                  ],
                ),
              )
              // Container(
              //   width: R.dimen.width,
              //   decoration: BoxDecoration(
              //       image: DecorationImage(
              //           image: AssetImage(
              //             R.image.mineVipBg,
              //           ),
              //           fit: BoxFit.fitWidth)),
              //   child: Row(
              //     children: [Image.asset(R.image.crown), Text("开通VIP会员立享超值特权")],
              //   ),
              // )
              ,
              Container(
                margin: EdgeInsets.only(bottom: R.dimen.dp14),
                child: Row(
                  children: [
                    for (KingKongEntity item in controller.utils)
                      Expanded(
                        child: GestureDetector(
                          onTap: item.onTap,
                          child: Container(
                            margin: EdgeInsets.only(
                                right: item == controller.utils.last
                                    ? 0
                                    : R.dimen.dp9),
                            padding: EdgeInsets.only(
                                left: R.dimen.dp12,
                                bottom: R.dimen.dp12,
                                top: R.dimen.dp12),
                            decoration: BoxDecoration(
                                color: R.color.ffffffff,
                                border: Border.all(
                                    color: R.color.ffd5d5d5.withOpacity(.59)),
                                borderRadius:
                                    BorderRadius.circular(R.dimen.sp5)),
                            child: Row(
                              children: [
                                Image.asset(item.icon),
                                Container(
                                  margin: EdgeInsets.only(left: R.dimen.dp8),
                                  child: Column(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                    children: [
                                      Text(
                                        item.label,
                                        style: TextStyle(
                                            color: R.color.ff222222,
                                            fontSize: R.dimen.sp13,
                                            fontWeight: FontWeight.w600),
                                      ),
                                      Container(
                                          margin: EdgeInsets.only(
                                              top: R.dimen.dp6 / 2),
                                          child: Text(
                                            "${item.description}",
                                            style: TextStyle(
                                                fontSize: R.dimen.sp9,
                                                color: R.color.ff999999),
                                          ))
                                    ],
                                  ),
                                )
                              ],
                            ),
                          ),
                        ),
                      )
                  ],
                ),
              ),
              Container(
                padding: EdgeInsets.symmetric(vertical: R.dimen.dp24),
                decoration: BoxDecoration(
                    color: R.color.ffffffff,
                    border:
                        Border.all(color: R.color.ffd5d5d5.withOpacity(.59)),
                    borderRadius: BorderRadius.circular(R.dimen.sp5)),
                child: Row(
                  children: [
                    for (KingKongEntity item in controller.kongos)
                      Expanded(
                        child: GestureDetector(
                          onTap: item.onTap,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Image.asset(item.icon),
                              Container(
                                margin: EdgeInsets.only(top: R.dimen.dp12),
                                child: Text(
                                  item.label,
                                  style: TextStyle(
                                      fontSize: R.dimen.sp12,
                                      color: R.color.ff222222),
                                ),
                              )
                            ],
                          ),
                        ),
                      ),
                  ],
                ),
              ),
              for (ListTileEntity item in controller.tiles)
                GestureDetector(
                  onTap: item.onTap,
                  child: Container(
                    padding: EdgeInsets.only(top: R.dimen.dp30),
                    child: Row(
                      children: [
                        Container(
                            margin: EdgeInsets.only(right: R.dimen.dp12),
                            child: Image.asset(item.icon)),
                        Text(
                          item.label,
                          style: TextStyle(
                              fontSize: R.dimen.sp15, color: R.color.ff222222),
                        ),
                        Spacer(),
                        Image.asset(R.image.next)
                      ],
                    ),
                  ),
                )
            ],
          ),
        ),
      ),
    );
  }
}
